<?php
    
  $aux = explode ( '|', isset($_GET['id']) ? $_GET['id'] : '' );
  $BenefitUid = str_replace ( '"', '', $aux[0] );
  
  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrBenefits.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrBenefitsPeer::retrieveByPK( $BenefitUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrBenefits' ) ) { 
     $fields['BENEFIT_UID'] = $tr->getBenefitUid();
     $fields['BENEFITNAME'] = $tr->getBenefitname();
     $fields['BENEFITDESCRIPTION'] = $tr->getBenefitdescription();
     $fields['UNITBENEFIT_ID'] = $tr->getUnitbenefitId();
     $fields['BENEFITCOST'] = $tr->getBenefitcost();
     $fields['BENEFITELEGIBILITY'] = $tr->getBenefitelegibility();
  }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'processmaker';
  $G_SUB_MENU = 'hr/menuhrEmployee';
  $G_ID_MENU_SELECTED = 'ID_HR_EMP';
  $G_ID_SUB_MENU_SELECTED = 'ID_HR_BENEFITS';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrBenefitsEdit', '', $fields, 'hrBenefitsSave' );
  G::RenderPage('publish', 'blank');   
?>